package me.keiwu.task.controller;

import me.keiwu.pub.data.ResponseV2;
import me.keiwu.pub.util.ContextUtil;
import me.keiwu.task.service.ExploreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;

/**
 * Created by kei on 01/02/2018.
 */
@RestController
@RequestMapping("/explore")
public class ExploreController {


    @Autowired
    private ExploreService exploreService;


    @RequestMapping("steal")
    public ResponseV2 steal(HttpServletRequest request, Long stealId) throws UnsupportedEncodingException {
        Long userId = ContextUtil.getLoginUserId(request);
        return exploreService.stealGold(userId, stealId);
    }

}
